var RunLayer = cc.Layer.extend({
	arr:null,
	scene:null,
	clock:null,
	ctor:function (parent) {
		this._super();
		this.scene = parent;
		this.scene.addChild(this, 20);
		gg.main = this;
		this.init();
	},
	init:function () {
		this.callNext = cc.callFunc(function(){
			gg.flow.next();
		}, this)
		this.callNext.retain();
		this.clock = new Clock(this);
		
		// 左称量纸
		var zhi1 = new Button(this, 11, TAG_CHENGLIANGZHI1, "#chengliangzhi.png", this.callback);
		zhi1.setPosition(930,290);
		zhi1.setVisible(false);
		// 右称量纸
		var zhi2 = new Button(this, 11, TAG_CHENGLIANGZHI2, "#chengliangzhi.png", this.callback);
		zhi2.setPosition(1080,290);
		zhi2.setVisible(false);
		// 物品库
		this.lib = new Lib(this);	
	},
	loadTianping:function(pos){
		var tianping = new Button(this, 10, TAG_TIANPING,"#tianping.png", this.callback);
		this.loadInLib(tianping, pos, cc.p(1000,250));
		var youma2 = new Button(tianping, 12, TAG_YOUMA2,"#youma.png", this.callback);
		youma2.setPosition(cc.p(60,80));
		var luomu=new Button(tianping, 12, TAG_LUOMU,"#luomu.png", this.callback,this);
		luomu.setPosition(cc.p(225,97));
		luomu.setRotation(-9);
	},
	loadTianping2:function(pos){
		var tianping2 = new Button(this, 10, TAG_TIANPING2,"#tianping.png", this.callback);
		this.loadInLib(tianping2, pos, cc.p(1000,250));
		var youma = new Button(tianping2, 12, TAG_YOUMA,"#youma.png", this.callback,this);
		youma.setPosition(cc.p(60,80));
	},
	loadFamahe:function(pos){
		var famahe = new Button(this, 10, TAG_FAMAHE,"#famahe.png", this.callback);
		famahe.setScale(0.5);
		this.loadInLib(famahe, pos, cc.p(600,250));
	},
	loadChengliangzhi:function(pos){
		var chengliangzhi = new Button(this, 10, TAG_CHENGLIANGZHI,"#chengliangzhi.png", this.callback);
		this.loadInLib(chengliangzhi, pos, cc.p(800,250));
	},
	loadCubenjiasuan:function(pos){
		this.cubenjaisuan = new BenBottle(this);
		this.addChild(this.cubenjaisuan, 20);
		this.loadInLib(this.cubenjaisuan, pos, cc.p(600, 250));
	},
	loadCyl:function(pos){
		var cylinder = new Button(this, 10, TAG_CYLINDER,"#cylinder.png", this.callback);
		this.loadInLib(cylinder, pos, cc.p(280,180));
		cylinder.setScale(0.6);
	},
	loadKettle:function(pos){
		this.kettle=new Kettle(this);
		this.addChild(this.kettle, 54);
		var action = null;
		if(gg.flow.flow != null){
			action = gg.flow.flow.action;
		}
		if(action==ACTION_DO1){			
			this.loadInLib(this.kettle, pos, cc.p(700,200));			
		}else if(action==ACTION_DO2){			
			this.loadInLib(this.kettle, pos, cc.p(1050, 350));
		}else if(action==ACTION_DO3){			
			this.loadInLib(this.kettle, pos, cc.p(1050, 350));
		}else{
			this.loadInLib(this.kettle, pos, cc.p(1050, 350));
		}		
	},
	loadSanjiaojia:function(pos){
		var sanjiaojia = new cc.Sprite("#sanjiaojia.png");
		sanjiaojia.setTag(TAG_SANJIAOJIA);
		this.addChild(sanjiaojia,50);
		this.loadInLib(sanjiaojia, pos, cc.p(650,200), 1);
	},
	loadShimianwang:function(pos){
		var shimianwang = new cc.Sprite("#shimianwang.png");
		shimianwang.setTag(TAG_SHIMIANWANG);
		this.addChild(shimianwang,51);
		this.loadInLib(shimianwang, pos, cc.p(645,255), 1);
	},
	loadJiujingdeng:function(pos){	
		this.jiujingdeng = new Lamp(this);
		this.addChild(this.jiujingdeng, 20);
		this.loadInLib(this.jiujingdeng, pos, cc.p(450,200));
	},
	loadJiujingdeng2:function(pos){	
		this.jiujingdeng2 = new Lamp(this);
		this.addChild(this.jiujingdeng2, 20);
		this.loadInLib(this.jiujingdeng2, pos, cc.p(450,200));
	},
	loadBolibang:function(pos){		
		var action = null;		
		if(gg.flow.flow != null){
			action = gg.flow.flow.action;
		}
		if(action==ACTION_DO1){
			var bolibang = new Button(this, 10, TAG_BOLIBANG,"#bolibang.png", this.callback);
			bolibang.setPosition(cc.p(1100,550));
			var move=cc.moveTo(0.6,cc.p(645,420))
			var rot=cc.rotateTo(0.6, 30);
			var spa=cc.spawn(move,rot);
			var mov=cc.moveTo(0.6, cc.p(645,344));
			bolibang.setScale(2);
			var rot1=cc.rotateTo(0.5, 30);
			var rot2=cc.rotateTo(0.5, 45);
			var rot3=cc.rotateTo(0.5, 15);
			var fad=cc.fadeOut(0);
			var seq=cc.sequence(spa,mov,cc.callFunc(function() {
				this.clock.loadTip("#tool/tip1.png");
				this.clock.doTime(4, 0.2);
				var beaker = this.getChildByTag(TAG_BEAKER);
				beaker.waitDiss(true);
			}, this),rot3,rot1,rot2,rot1,rot3,rot1,rot2,rot1,fad,cc.callFunc(function() {
				gg.flow.next();
			}, this));
			bolibang.runAction(seq);				
		}else if(action==ACTION_DO2){
			var beaker = this.getChildByTag(TAG_BEAKER);
			var bolibang = new Button(this, 10, TAG_BOLIBANG,"#bolibang.png", this.callback);
			bolibang.setScale(2);
			bolibang.setPosition(cc.p(1100,550));
			var move=cc.moveTo(0.6,cc.p(645,420))
			var rot=cc.rotateTo(0.6, 30);
			var spa=cc.spawn(move,rot);
			var mov=cc.moveTo(0.6, cc.p(645,344));
			var rot1=cc.rotateTo(0.5, 30);
			var rot2=cc.rotateTo(0.5, 45);
			var rot3=cc.rotateTo(0.5, 15);
			var fad=cc.fadeOut(0);
			var seq=cc.sequence(spa,mov,cc.callFunc(function() {
				this.clock.loadTip("#tool/tip2.png");
				this.clock.doTime(4, 0.2);	
				beaker.waitTan(true);
			}, this),rot3,rot1,rot2,rot1,rot3,rot1,rot2,rot1,fad,cc.callFunc(function() {
				gg.flow.next();
			}, this));
			bolibang.runAction(seq);									
		}else {
			var bolibang = new Button(this, 10, TAG_BOLIBANG_YINLIU,"#bolibang.png", this.callback);
			bolibang.setScale(2);
			bolibang.setRotation(15);
			bolibang.setPosition(cc.p(1100,600));
			var move=cc.moveTo(1,cc.p(185, 348));
			bolibang.runAction(cc.sequence(move,cc.callFunc(function() {
				gg.flow.next();
			}, this)));
		}
	},
	loadHuoxingtan:function(pos){
		this.huoxingtan = new HuoBottle(this);
		this.addChild(this.huoxingtan, 20);
		this.loadInLib(this.huoxingtan, pos, cc.p(350, 300));
	},
	loadGuangkouping:function(pos){
		this.guangkouping = new Guangkouping(this);
		this.addChild(this.guangkouping, 20);
		this.loadInLib(this.guangkouping, pos, cc.p(350, 300));
	},
	loadTiejiatai:function(pos){	
		var tiejiatai = new Button(this, 10, TAG_TIEJIATAI, "#tiejiatai.png");
		this.loadInLib(tiejiatai, pos, cc.p(200, 300));
	},
	loadBeaker:function(pos){
		var action = null;
		if(gg.flow.flow != null){
			action = gg.flow.flow.action;
		}
		if(action == ACTION_DO1){
			var beaker = new Beaker(this, 53, TAG_BEAKER, this.callback); 
			this.loadInLib(beaker, pos, cc.p(550, 140));
		}else if(action==ACTION_DO2){
			var beaker = new Beaker(this, 53, TAG_BEAKER2, this.callback); 
			this.loadInLib(beaker, pos, cc.p(170, 185));
		} else{
			var beaker = new Beaker(this, 53, TAG_BEAKER3, this.callback); 
			this.loadInLib(beaker, pos, cc.p(645,290));
		}
	},
	loadBiaomianmin:function(pos){
		var biaomianmin = new Button(this, 54, TAG_BIAOMIANMIN,"#biaomianmin.png", this.callback);			
		if(gg.flow.flow.action==ACTION_DO1){			
			this.loadInLib(biaomianmin, pos, cc.p(647,325));
		}else {
			this.loadInLib(biaomianmin, pos, cc.p(1070,290));						
		}
	},
	loadGangshao:function(pos){
		var gangshao = new Button(this, 10, TAG_GANGSHAO, "#spoon4.png",this.callback);	
//		this.loadInLib(gangshao, pos, cc.p(950, 390));
		gangshao.setPosition(cc.p(1100,600));
		var biao=this.getChildByTag(TAG_BIAOMIANMIN);
		var rota=cc.rotateTo(0.6, 150);
		var move1=cc.moveTo(0.6, cc.p(705, 360));
		var move2=cc.moveTo(0.6, cc.p(655, 360));
		var move3=cc.moveTo(0.6, cc.p(685, 360));
		var rot=cc.rotateTo(0.6, 55);
		var spw=cc.spawn(move1,rota);
		var seq=cc.sequence(spw,move2,move3,move2,cc.callFunc(function() {
			var jingti=this.getChildByTag(TAG_BUSHILOUDOU).getChildByTag(TAG_JINGTI);
			var fad=cc.fadeOut(2);
			jingti.runAction(fad);
		}, this),move3,cc.callFunc(function(){
			this.clock.loadTip("#tool/tip4.png");
			this.clock.doTime(4, 0.2);	
		}, this),cc.callFunc(function() {
			var gang=this.getChildByTag(TAG_GANGSHAO);
			var loudou=this.getChildByTag(TAG_BUSHILOUDOU);
			var chou=this.getChildByTag(TAG_CHOULV);
			var line=this.getChildByTag(TAG_BUSHI_LINE);
			gang.setVisible(false);
			var move=cc.moveTo(0.6,cc.p(487,392) );
			var rot=cc.rotateTo(0.6, 0);
			var move1=cc.moveTo(0.6, cc.p(487,352));
			var spw=cc.spawn(move,rot);
			var fad=cc.fadeOut(0);
			var seq=cc.sequence(spw,move1,cc.callFunc(function() {
				chou.setVisible(false);
				line.setVisible(false);
			},this),fad,this.callNext);
			loudou.runAction(seq)
		}, this));
		gangshao.runAction(seq);
	},
	showLvzhi:function(pos){
		var filter = new Win(this,"#filter_paper.png");
		filter.show(true);
	},
	loadLvzhi:function(pos){
		var lvzhi = new Button(this, 10, TAG_LVZHI, "#lvzhi3.png",this.callback);		
		lvzhi.setPosition(cc.p(500,380));
	},
	showBolibang:function(pos){
		if(gg.flow.flow.action==ACTION_DO1){
			this.loadBolibang();
		}else if(gg.flow.flow.action==ACTION_DO2){
			this.loadBolibang();
		}else{			
			var bo_yinliu = new Win(this,"#paper_funnel.png");
			bo_yinliu.show(true);
		}
	},
	loadRelvloudou:function(pos){
		var relvloudou = new Button(this, 10, TAG_RELVLOUDOU, "#relv3.png",this.callback);
		this.loadInLib(relvloudou, pos, cc.p(800, 350));
	},
	loadChoulv:function(pos){
		var choulv = new Button(this, 10, TAG_CHOULV, "#air.png",this.callback);	
		this.loadInLib(choulv, pos, cc.p(370,300), 1.5);
	},
	loadChou_open:function(){
		var choulv = new Chou(this);
	},
	loadBushiloudou:function(pos){
		var bushiloudou = new Button(this, 10, TAG_BUSHILOUDOU, "#air_funnel.png",this.callback);
		this.loadInLib(bushiloudou, pos, cc.p(487, 352));
	},
	loadInLib:function(obj, pos, tarPos,delay){
		obj.setPosition(pos);
		if(delay == null){
			delay = 1;
		}
		var ber = $.bezier(pos, tarPos, delay);
		var seq = cc.sequence(ber, this.callNext);
		obj.runAction(seq);
	},
	kill:function(obj){
		var fade = cc.fadeTo(0.5,0);
		var func = cc.callfunc(function(){
			obj.removeFromParent(true);
		},this);
		var seq = cc.sequence(fade,func);
		obj.runAction(seq)
	},
	callback:function (p){
		var func = cc.callFunc(this.actionDone, this);
		var action=gg.flow.flow.action;
		switch(p.getTag()){
			case TAG_CHENGLIANGZHI:
				var move=cc.moveTo(0.6, cc.p(1005,300));
				var fad=cc.fadeOut(0);
				var spw=cc.spawn(fad,func);
				var seq=cc.sequence(move,spw);
				p.runAction(seq);
			break;
			case TAG_FAMAHE:
				p.setSpriteFrame("famahe_open.png");
				p.setScale(1);
				var fama = new Button(this, 12, TAG_FAMA,"#fama.png", this.callback);
				fama.setPosition(600,248);		
				gg.flow.next();
				break;
			case TAG_FAMA:
				var move=cc.moveTo(0.6, cc.p(1080,293));
				var seq=cc.sequence(move,func);
				p.runAction(seq);
				break;
			case TAG_LUOMU:
				this.showDisk();
				break;
			case TAG_LVZHI:
				var move=cc.moveTo(0.6,cc.p(180,255));
				var seq=cc.sequence(move,func);
				p.runAction(seq);
				break;
			case TAG_CHENGLIANGZHI1:
				var move = cc.moveTo(1,cc.p(520,220));
				var rotate = cc.rotateTo(0.5, 40);
				var seq = cc.sequence(move,rotate,func);
				p.runAction(seq);
				break;
			
			case TAG_CYLINDER:
				var move = cc.moveTo(0.6,cc.p(440,210));
				var rotate = cc.rotateTo(0.6, 100);
				var delay = cc.delayTime(2);
				var move2 = cc.moveTo(1,cc.p(280,180));
				var rotate2 = cc.rotateTo(1, 0);
				var spawn2 = cc.spawn(move2,rotate2);
				var seq = cc.sequence(move,cc.callFunc(function() {
					var line = this.getChildByTag(TAG_CYLINDER).getChildByTag(TAG_LINE);
					var rot=cc.rotateTo(0.6, -60);
					var sca2=cc.scaleTo(0.6, 1.2,1);
					var spa2=cc.spawn(rot,sca2);
					var move=cc.moveTo(1, cc.p(42,63));
					var sca=cc.scaleTo(0.5, 0.1);
					var mov=cc.moveTo(0.5,cc.p(55,32));
					var spa=cc.spawn(sca,mov);
					var seq=cc.sequence(spa2,move,spa);
					line.runAction(seq);
				}, this),rotate,func,delay,spawn2,cc.callFunc(function(){
					p.removeFromParent();
				},this));
				p.runAction(seq);
				break;
			case TAG_BEAKER:
				if(action==ACTION_DO1){
					var bezier = cc.bezierTo(1, [cc.p(540,350),cc.p(620,320),cc.p(643,285)]);
					var seq=cc.sequence(bezier,func);
					p.runAction(seq);					
				}else if(action==ACTION_DO2){
					var bezier = cc.bezierTo(1, [cc.p(543,285),cc.p(500,320),cc.p(450, 140)]);
					var seq=cc.sequence(bezier,func);
					p.runAction(seq);
				}else if(action==ACTION_DO3){
					this.beakerYinliu(p);			
					var boli=this.getChildByTag(TAG_BOLIBANG_YINLIU);
					var seq=cc.sequence(cc.delayTime(5),cc.callFunc(function() {
						boli.removeFromParent();
					},this));
					boli.runAction(seq);						
				}
				break;
			case TAG_BEAKER2:
				if(action == ACTION_DO1){			
					var bezier = cc.bezierTo(1, [cc.p(200,485),cc.p(340,580),cc.p(439,449)]);
					var rot=cc.rotateTo(0.6, 55);
					var rot1=cc.rotateTo(1.2, 95);
					var mov1=cc.moveTo(1, cc.p(451,456));
					var spa1=cc.spawn(rot1,mov1);
					var rot3=cc.rotateTo(0.6, 0);
					var mov3=cc.moveTo(0.6, cc.p(439,449));
					var spa3=cc.spawn(rot3,mov3);
					var seq=cc.sequence(bezier,cc.callFunc(function() {
						var line = this.getChildByTag(TAG_BEAKER2).getChildByTag(TAG_BEAKER_LINE);

						var moveto=cc.moveTo(0.6,cc.p(34,40));
						var rotate=cc.rotateTo(0.6, -55);
						var scale=cc.scaleTo(0.6, 1.5, 0.5);
						var spawn=cc.spawn(moveto,rotate,scale);


						var moveto1=cc.moveTo(0.8,cc.p(50,40))
						var scale1=cc.scaleTo(0.8, 1.3,0.4);
						var rotate1=cc.rotateTo(0.8, -80);
						var spawn1=cc.spawn(moveto1,scale1,rotate1);

						var moveto2=cc.moveTo(0.8,cc.p(53,40))
						var scale2=cc.scaleTo(0.8, 1.3,0.2);
						var rotate2=cc.rotateTo(0.8, -87);
						var spawn2=cc.spawn(moveto2,rotate2,scale2);

						var moveto3=cc.moveTo(0.8,cc.p(56,72))
						var scale3=cc.scaleTo(0.8, 0.1,0.1);
						var spawn3=cc.spawn(moveto3,scale3);

						var seq1=cc.sequence(spawn,spawn1,spawn2,spawn3,cc.callFunc(function() {
							line.removeFromParent();
						}, this));
						line.runAction(seq1);
					}, this),cc.callFunc(function() {
						var beaker2=this.getChildByTag(TAG_BEAKER2);
						beaker2.waitJing();
					}, this),rot,cc.callFunc(function() {
						this.flowDown(0,cc.p(491,445),2);
						var bushi=this.getChildByTag(TAG_BUSHILOUDOU);
						var jingti=new cc.Sprite("#salt5.png");
						jingti.setTag(TAG_JINGTI);
						jingti.setScale(0.3);
						jingti.setPosition(cc.p(18,75));
						bushi.addChild(jingti,10);
						this.schedule(this.loadWpoint,0.1,15);	
						var line=new cc.Sprite("#beaker_line.png");
						line.setPosition(cc.p(487,260));
						this.addChild(line,20);
						line.setTag(TAG_BUSHI_LINE);
						var move=cc.moveTo(2, cc.p(487,270));
						var sca=cc.scaleTo(2, 0.9);
						var spa=cc.spawn(move,sca);
						line.runAction(spa);
					}, this),spa1,cc.delayTime(2),spa3,this.callNext);								
					p.runAction(seq);
				} else if(action == ACTION_DO2){
					var rot=cc.rotateTo(0.6, 55);
					var rot1=cc.rotateTo(1.2, 95);
					var mov1=cc.moveTo(1, cc.p(451,456));
					var spa1=cc.spawn(rot1,mov1);
					var rot3=cc.rotateTo(0.6, 0);
					var mov3=cc.moveTo(0.6, cc.p(439,449));
					var spa3=cc.spawn(rot3,mov3);
					var seq=cc.sequence(cc.callFunc(function(){
						var line = this.getChildByTag(TAG_BEAKER2).getChildByTag(TAG_BEAKER2_LINE);

						var moveto=cc.moveTo(0.6,cc.p(34,40));
						var rotate=cc.rotateTo(0.6, -55);
						var scale=cc.scaleTo(0.6, 1.5, 0.5);
						var spawn=cc.spawn(moveto,rotate,scale);


						var moveto1=cc.moveTo(0.8,cc.p(50,40))
						var scale1=cc.scaleTo(0.8, 1.3,0.4);
						var rotate1=cc.rotateTo(0.8, -80);
						var spawn1=cc.spawn(moveto1,scale1,rotate1);

						var moveto2=cc.moveTo(0.8,cc.p(53,40))
						var scale2=cc.scaleTo(0.8, 1.3,0.2);
						var rotate2=cc.rotateTo(0.8, -87);
						var spawn2=cc.spawn(moveto2,rotate2,scale2);

						var moveto3=cc.moveTo(0.8,cc.p(56,72))
						var scale3=cc.scaleTo(0.8, 0.1,0.1);
						var spawn3=cc.spawn(moveto3,scale3);

						var seq1=cc.sequence(spawn,spawn1,spawn2,spawn3,cc.callFunc(function() {
							line.removeFromParent();
						}, this));
						line.runAction(seq1);							
					},this),rot,cc.callFunc(function(){
						this.flowDown(0,cc.p(491,445),2);
						this.schedule(this.loadWpoint,0.1,15);	
						var line=this.getChildByTag(TAG_BUSHI_LINE);
						var move=cc.moveTo(2, cc.p(487,285));
						var sca=cc.scaleTo(2, 0.8);
						var spa=cc.spawn(move,sca);
						line.runAction(spa);
					},this),spa1,cc.delayTime(2),spa3,func,cc.callFunc(function() {
						p.removeFromParent();
					}, this));
					p.runAction(seq);
				}				
				break;
			case TAG_RELVLOUDOU:
				var move=cc.moveTo(0.6, cc.p(200,260));
				var seq=cc.sequence(move,func);
				p.runAction(seq);
				break;			
			case TAG_CHOULV:
				this.loadChou_open();
				gg.flow.next();
				break;
			case TAG_BUSHILOUDOU:
				var move=cc.moveTo(0.6,cc.p(487,432));
				var move1=cc.moveTo(0.6, cc.p(580,370));
				var rot=cc.rotateTo(0.6, 100);
				var seq = cc.sequence(move, move1,rot,cc.callFunc(function() {
					var min=this.getChildByTag(TAG_BIAOMIANMIN);
					min.setSpriteFrame("biaomian2.png");
				}, this),func);
				p.runAction(seq);
				break;
			case TAG_BIAOMIANMIN:
				if(action==ACTION_DO1){
					var move=cc.moveTo(0.6, cc.p(930,290));
					var seq=cc.sequence(move,this.callNext);
					p.runAction(seq);
				}else if(action==ACTION_DO2){
					var move=cc.moveTo(0.6, cc.p(300,390));
					var rot=cc.rotateTo(0.6, 30);
					var seq=cc.sequence(move,rot,this.callNext);
					p.runAction(seq);
				}
				break;
			case TAG_YOUMA:
				var move=cc.moveTo(0.6, cc.p(113,80));
				var seq=cc.sequence(move,cc.callFunc(function() {
					this.showDisk();
				}, this),func);
				p.runAction(seq);
				break;
			case TAG_TIANPING2:
				var dushu=new Kedu(this);
				break;			
			default:
				break;
		}
	},
	beakerYinliu:/**
					 * 烧杯引流
					 */
	function(p, tag){
		// 通过引流棒过滤
		var bezier = cc.bezierTo(1, [cc.p(520,340),cc.p(385,540),cc.p(220,370)]);
		var rot=cc.rotateTo(0.6, -55);
		var rot1=cc.rotateTo(0.6, -80);
		var rot2=cc.rotateTo(0.6, -95);
		var rot3=cc.rotateTo(0.6, 0);
		var seq=cc.sequence(bezier,cc.callFunc(function() {
			var line = this.getChildByTag(TAG_BEAKER).getChildByTag(TAG_BEAKER_LINE);

			var moveto=cc.moveTo(0.6,cc.p(28,39));
			var rotate=cc.rotateTo(0.6, 55);
			var scale=cc.scaleTo(0.6, 1.4, 0.5);
			var spawn=cc.spawn(moveto,rotate,scale);


			var moveto1=cc.moveTo(0.8,cc.p(14,39))
			var scale1=cc.scaleTo(0.8, 1.4,0.4);
			var rotate1=cc.rotateTo(0.8, 80);
			var spawn1=cc.spawn(moveto1,scale1,rotate1);

			var moveto2=cc.moveTo(0.8,cc.p(8,39))
			var scale2=cc.scaleTo(0.8, 1.4,0.2);
			var rotate2=cc.rotateTo(0.8, 87);
			var spawn2=cc.spawn(moveto2,rotate2,scale2);

			var moveto3=cc.moveTo(0.8,cc.p(8,72))
			var scale3=cc.scaleTo(0.8, 0.1,0.1);
			var spawn3=cc.spawn(moveto3,scale3);

			var seq1=cc.sequence(spawn,spawn1,spawn2,spawn3);
			line.runAction(seq1);
		}, this),cc.callFunc(function() {
			var deposit1=this.getChildByTag(TAG_BEAKER).getChildByTag(TAG_BEAKER_DEPOSIT1);
			var sca1=cc.scaleTo(0.6,1.4,1 );
			var	mov1=cc.moveTo(0.6,cc.p(20,19));
			var spa111=cc.spawn(sca1,mov1);

			var sca=cc.scaleTo(1.5, 0.3, 0.3);
			var mov=cc.moveTo(1.5, cc.p(11,37));
			var fad=cc.fadeOut(1.5);
			var spa=cc.spawn(sca,mov,fad);			
			var seq111=cc.sequence(spa111,spa,cc.callFunc(function() {
				deposit1.removeFromParent();
			}, this));
			deposit1.runAction(seq111);
		}, this),rot,cc.callFunc(function() {
			var beaker2=this.getChildByTag(TAG_BEAKER2);
			beaker2.upLine(false);
		}, this),rot1,rot2,cc.delayTime(2),rot3,cc.callFunc(function() {
			p.removeFromParent();
		}, this),this.callNext);
		p.runAction(seq);
	},
	showDisk:/**
	 * 出现指针
	 */
		function(){
		var disk = new DiskPoint();
		disk.setPosition(this.width*0.8-35,this.height*0.5);
		disk.setScale(2);
		this.addChild(disk,50);
		disk.show();
	},
	/**水滴**/
	loadWpoint:function(){
		var wpoint=new cc.Sprite("#wpoint.png");
		wpoint.setScale(0.5);
		wpoint.setPosition(cc.p(487,330));
		this.addChild(wpoint,20);
		var move=cc.moveTo(0.6, cc.p(487,270));
		var seq=cc.sequence(move,cc.callFunc(function() {
			wpoint.removeFromParent();
		}, this));
		wpoint.runAction(seq);			
	},
	actionDone:function(p){
		var func = cc.callFunc(this.actionDone, this);
		var action=gg.flow.flow.action;
		var zhi1=this.getChildByTag(TAG_CHENGLIANGZHI1);
		var zhi2=this.getChildByTag(TAG_CHENGLIANGZHI2);
		var tian=this.getChildByTag(TAG_TIANPING);
		var fama=this.getChildByTag(TAG_FAMA);
		var beaker=this.getChildByTag(TAG_BEAKER);
		var beaker2=this.getChildByTag(TAG_BEAKER2);
		switch(p.getTag()){
			case TAG_CHENGLIANGZHI:		
				zhi1.setVisible(true);
				zhi2.setVisible(true);
				gg.flow.next();
			break;
			case TAG_CHENGLIANGZHI1:
				zhi2.setVisible(false);
				tian.setVisible(false);
				fama.setVisible(false);
				p.removeFromParent();
				beaker.showSalt(true);				
				break;
			case TAG_FAMA:
				var famahe=this.getChildByTag(TAG_FAMAHE);
				famahe.setVisible(false);
				var _5g=new cc.LabelTTF("5g","Arral","30");
				_5g.setPosition(cc.p(70,45));
				_5g.setColor(cc.color(0,0,0));
				zhi2.addChild(_5g,100);
				gg.flow.next();
				break;
			case TAG_LVZHI:	
				var lvzhi=this.getChildByTag(TAG_LVZHI);
				var tie=this.getChildByTag(TAG_TIEJIATAI);
				var loudou=this.getChildByTag(TAG_RELVLOUDOU);
				lvzhi.setVisible(false);
				tie.setVisible(false);
				loudou.setVisible(false);
				var tie2=new cc.Sprite("#tiejiatai2.png");
				tie2.setTag(TAG_TIEJIATAI2);
				tie2.setPosition(200,300);
				this.addChild(tie2);
				gg.flow.next();
				break;		
			case TAG_RELVLOUDOU:
				var loudou=this.getChildByTag(TAG_RELVLOUDOU);
				var tie=this.getChildByTag(TAG_TIEJIATAI)
				tie.setSpriteFrame("tiejiatai3.png");
				loudou.setVisible(false);
				gg.flow.next();
				break;		
			case TAG_BEAKER:
				if(action==ACTION_DO1){
					gg.flow.next();
				}else if(action==ACTION_DO2){
					gg.flow.next();
				}
				break;
			case TAG_BEAKER2:
					gg.flow.next();			
				break;
			case TAG_BOLIBANG:	
				p.removeFromParent();
				gg.flow.next();
				break;
			case TAG_BUSHILOUDOU:
				gg.flow.next();
				break;			
			case TAG_CYLINDER:
				// 倒入50ml的水
				var beaker = this.getChildByTag(TAG_BEAKER);
				beaker.upLine(true);				
				this.flowLeft(p,-100,cc.p(55,346),0.8);
				break;
		}
	},
	flowLeft:function(p,view,pos,time){
		var flowLeft = new cc.Sprite("#flow_left.png");
		flowLeft.setAnchorPoint(1, 1);
		flowLeft.setScale(0);
		flowLeft.setRotation(view);
		flowLeft.setPosition(pos);
		p.addChild(flowLeft);
		var seq = cc.sequence(cc.scaleTo(0.5,0.8),cc.delayTime(time),cc.scaleTo(0.2,0));
		flowLeft.runAction(seq);
	},
	flowRight:function(p,view,pos){
		var flowRight = new cc.Sprite("#flow_right.png");
		flowRight.setAnchorPoint(1, 1);
		flowRight.setScale(0);
		flowRight.setRotation(view);
		flowRight.setPosition(pos);
		p.addChild(flowRight);
		var seq = cc.sequence(cc.scaleTo(0.5,1),cc.delayTime(0.8),cc.scaleTo(0.2,0));
		flowRight.runAction(seq);
	},
	flowDown:function(view,pos,time){
		var flowDown = new cc.Sprite("#flow_down.png");
		flowDown.setAnchorPoint(1, 1);
		flowDown.setScale(0);
		flowDown.setRotation(view);
		flowDown.setPosition(pos);
		ll.run.addChild(flowDown);
		var seq = cc.sequence(cc.scaleTo(0.5,0.7),cc.delayTime(time),cc.scaleTo(0.2,0));
		flowDown.runAction(seq);
	},
	flowNext:function(){
		gg.flow.next();
	},
	onExit:function(){
		this._super();
		this.callNext.release();
	}
});